package io.github.harmonly.mapper;

import io.github.harmonly.entity.activity.Star;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StarMapper {

    @Select("select * from star where sid = #{sid}")
    Star getStar(int sid);

    @Select("select * from star")
    List<Star> getStars();

    @Select("select * from star where uid = #{uid}")
    List<Star> getStarsByUser(int uid);

    @Select("select * from star where cid = #{cid}")
    List<Star> getStarsByActivity(int cid);

    @Insert("insert into star(uid, cid, star) VALUES(#{uid}, #{cid}, #{star})")
    int addStar(Star star);

    @Delete("delete star from star where sid = #{sid}")
    int deleteStar(int sid);
}
